/* eslint-disable */
/* tslint:disable */
/*
 * ---------------------------------------------------------------
 * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
 * ##                                                           ##
 * ## AUTHOR: acacode                                           ##
 * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
 * ---------------------------------------------------------------
 */

export type QueryParamsType = Record<string | number, any>;
export type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;

export interface FullRequestParams extends Omit<RequestInit, 'body'> {
  /** set parameter to `true` for call `securityWorker` for this request */
  secure?: boolean;
  /** request path */
  path: string;
  /** content type of request body */
  type?: ContentType;
  /** query params */
  query?: QueryParamsType;
  /** format of response (i.e. response.json() -> format: "json") */
  format?: ResponseFormat;
  /** request body */
  body?: unknown;
  /** base url */
  baseUrl?: string;
  /** request cancellation token */
  cancelToken?: CancelToken;
}

export type RequestParams = Omit<
  FullRequestParams,
  'body' | 'method' | 'query' | 'path'
>;

export interface ApiConfig<SecurityDataType = unknown> {
  baseUrl?: string;
  baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>;
  securityWorker?: (
    securityData: SecurityDataType | null
  ) => Promise<RequestParams | void> | RequestParams | void;
  customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown>
  extends Response {
  data: D;
  error: E;
}

type CancelToken = Symbol | string | number;

export enum ContentType {
  Json = 'application/json',
  FormData = 'multipart/form-data',
  UrlEncoded = 'application/x-www-form-urlencoded',
  Text = 'text/plain',
}

export class HttpClient<SecurityDataType = unknown> {
  public baseUrl: string = 'http://localhost:5001';
  private securityData: SecurityDataType | null = null;
  private securityWorker?: ApiConfig<SecurityDataType>['securityWorker'];
  private abortControllers = new Map<CancelToken, AbortController>();
  private customFetch = (...fetchParams: Parameters<typeof fetch>) =>
    fetch(...fetchParams);

  private baseApiParams: RequestParams = {
    credentials: 'same-origin',
    headers: {},
    redirect: 'follow',
    referrerPolicy: 'no-referrer',
  };

  constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
    Object.assign(this, apiConfig);
  }

  public setSecurityData = (data: SecurityDataType | null) => {
    this.securityData = data;
  };

  protected encodeQueryParam(key: string, value: any) {
    const encodedKey = encodeURIComponent(key);
    return `${encodedKey}=${encodeURIComponent(typeof value === 'number' ? value : `${value}`)}`;
  }

  protected addQueryParam(query: QueryParamsType, key: string) {
    return this.encodeQueryParam(key, query[key]);
  }

  protected addArrayQueryParam(query: QueryParamsType, key: string) {
    const value = query[key];
    return value.map((v: any) => this.encodeQueryParam(key, v)).join('&');
  }

  protected toQueryString(rawQuery?: QueryParamsType): string {
    const query = rawQuery || {};
    const keys = Object.keys(query).filter(
      key => 'undefined' !== typeof query[key]
    );
    return keys
      .map(key =>
        Array.isArray(query[key])
          ? this.addArrayQueryParam(query, key)
          : this.addQueryParam(query, key)
      )
      .join('&');
  }

  protected addQueryParams(rawQuery?: QueryParamsType): string {
    const queryString = this.toQueryString(rawQuery);
    return queryString ? `?${queryString}` : '';
  }

  private contentFormatters: Record<ContentType, (input: any) => any> = {
    [ContentType.Json]: (input: any) =>
      input !== null && (typeof input === 'object' || typeof input === 'string')
        ? JSON.stringify(input)
        : input,
    [ContentType.Text]: (input: any) =>
      input !== null && typeof input !== 'string'
        ? JSON.stringify(input)
        : input,
    [ContentType.FormData]: (input: any) =>
      Object.keys(input || {}).reduce((formData, key) => {
        const property = input[key];
        formData.append(
          key,
          property instanceof Blob
            ? property
            : typeof property === 'object' && property !== null
              ? JSON.stringify(property)
              : `${property}`
        );
        return formData;
      }, new FormData()),
    [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
  };

  protected mergeRequestParams(
    params1: RequestParams,
    params2?: RequestParams
  ): RequestParams {
    return {
      ...this.baseApiParams,
      ...params1,
      ...(params2 || {}),
      headers: {
        ...(this.baseApiParams.headers || {}),
        ...(params1.headers || {}),
        ...((params2 && params2.headers) || {}),
      },
    };
  }

  protected createAbortSignal = (
    cancelToken: CancelToken
  ): AbortSignal | undefined => {
    if (this.abortControllers.has(cancelToken)) {
      const abortController = this.abortControllers.get(cancelToken);
      if (abortController) {
        return abortController.signal;
      }
      return void 0;
    }

    const abortController = new AbortController();
    this.abortControllers.set(cancelToken, abortController);
    return abortController.signal;
  };

  public abortRequest = (cancelToken: CancelToken) => {
    const abortController = this.abortControllers.get(cancelToken);

    if (abortController) {
      abortController.abort();
      this.abortControllers.delete(cancelToken);
    }
  };

  public request = async <T = any, E = any>({
    body,
    secure,
    path,
    type,
    query,
    format,
    baseUrl,
    cancelToken,
    ...params
  }: FullRequestParams): Promise<HttpResponse<T, E>> => {
    const secureParams =
      ((typeof secure === 'boolean' ? secure : this.baseApiParams.secure) &&
        this.securityWorker &&
        (await this.securityWorker(this.securityData))) ||
      {};
    const requestParams = this.mergeRequestParams(params, secureParams);
    const queryString = query && this.toQueryString(query);
    const payloadFormatter = this.contentFormatters[type || ContentType.Json];
    const responseFormat = format || requestParams.format;

    return this.customFetch(
      `${baseUrl || this.baseUrl || ''}${path}${queryString ? `?${queryString}` : ''}`,
      {
        ...requestParams,
        headers: {
          ...(requestParams.headers || {}),
          ...(type && type !== ContentType.FormData
            ? { 'Content-Type': type }
            : {}),
        },
        signal: cancelToken
          ? this.createAbortSignal(cancelToken)
          : requestParams.signal,
        body:
          typeof body === 'undefined' || body === null
            ? null
            : payloadFormatter(body),
      }
    ).then(async response => {
      const r = response as HttpResponse<T, E>;
      r.data = null as unknown as T;
      r.error = null as unknown as E;

      const data = !responseFormat
        ? r
        : await response[responseFormat]()
            .then(data => {
              if (r.ok) {
                r.data = data;
              } else {
                r.error = data;
              }
              return r;
            })
            .catch(e => {
              r.error = e;
              return r;
            });

      if (cancelToken) {
        this.abortControllers.delete(cancelToken);
      }

      if (!response.ok) throw data;
      return data;
    });
  };
}

/**
 * @title AutoCost API
 * @version 1.0.0
 * @baseUrl http://localhost:5001
 * @contact AutoCost Team <support@autocost.com>
 *
 * AutoCost - 汽车费用管理应用后端API
 */
export class Api<
  SecurityDataType extends unknown,
> extends HttpClient<SecurityDataType> {
  api = {
    /**
     * No description
     *
     * @tags 图表
     * @name ChartsFuelTrendList
     * @summary 油耗趋势图表数据
     * @request GET:/api/charts/fuel-trend
     * @secure
     */
    chartsFuelTrendList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/charts/fuel-trend`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 图表
     * @name ChartsExpenseTrendList
     * @summary 费用趋势图表数据
     * @request GET:/api/charts/expense-trend
     * @secure
     */
    chartsExpenseTrendList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/charts/expense-trend`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 图表
     * @name ChartsIncomeTrendList
     * @summary 收入趋势图表数据
     * @request GET:/api/charts/income-trend
     * @secure
     */
    chartsIncomeTrendList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/charts/income-trend`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 图表
     * @name ChartsExpensePieList
     * @summary 费用分类饼图数据
     * @request GET:/api/charts/expense-pie
     * @secure
     */
    chartsExpensePieList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/charts/expense-pie`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 图表
     * @name ChartsMileageTrendList
     * @summary 行程趋势图表数据
     * @request GET:/api/charts/mileage-trend
     * @secure
     */
    chartsMileageTrendList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/charts/mileage-trend`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 费用记录
     * @name ExpensesCreate
     * @summary 创建费用记录
     * @request POST:/api/expenses
     * @secure
     */
    expensesCreate: (
      data: {
        /** 车辆ID */
        vehicleId: string;
        /** 费用类型 */
        type:
          | '加油'
          | '保养'
          | '维修'
          | '停车费'
          | '年检'
          | '保险'
          | '罚单'
          | '过路费'
          | '拖车费'
          | '洗车费'
          | '车位费';
        /** 费用金额 */
        amount: number;
        /**
         * 费用日期
         * @format date
         */
        date: string;
        /** 里程表 */
        odometer: number;
        /** 描述 */
        description?: string;
        /** 图片URL */
        imageUrl?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/expenses`,
        method: 'POST',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 费用记录
     * @name ExpensesList
     * @summary 获取费用记录列表
     * @request GET:/api/expenses
     * @secure
     */
    expensesList: (
      query?: {
        /**
         * 页码
         * @default 1
         */
        page?: number;
        /**
         * 每页数量
         * @default 10
         */
        limit?: number;
        /** 车辆ID筛选 */
        vehicleId?: string;
        /** 费用类型筛选 */
        type?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/expenses`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 费用记录
     * @name ExpensesDetail
     * @summary 获取费用记录详情
     * @request GET:/api/expenses/{id}
     * @secure
     */
    expensesDetail: (id: string, params: RequestParams = {}) =>
      this.request<void, void>({
        path: `/api/expenses/${id}`,
        method: 'GET',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 费用记录
     * @name ExpensesUpdate
     * @summary 更新费用记录
     * @request PUT:/api/expenses/{id}
     * @secure
     */
    expensesUpdate: (
      id: string,
      data: {
        /** 费用类型 */
        type?: string;
        /** 费用金额 */
        amount?: number;
        /**
         * 费用日期
         * @format date
         */
        date?: string;
        /** 里程表 */
        odometer?: number;
        /** 描述 */
        description?: string;
        /** 图片URL */
        imageUrl?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/expenses/${id}`,
        method: 'PUT',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 费用记录
     * @name ExpensesDelete
     * @summary 删除费用记录
     * @request DELETE:/api/expenses/{id}
     * @secure
     */
    expensesDelete: (id: string, params: RequestParams = {}) =>
      this.request<void, void>({
        path: `/api/expenses/${id}`,
        method: 'DELETE',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 收入记录
     * @name IncomesCreate
     * @summary 创建收入记录
     * @request POST:/api/incomes
     * @secure
     */
    incomesCreate: (
      data: {
        /** 车辆ID */
        vehicleId: string;
        /** 收入类型 */
        type: string;
        /** 收入金额 */
        amount: number;
        /**
         * 收入日期
         * @format date
         */
        date: string;
        /** 描述 */
        description?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/incomes`,
        method: 'POST',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 收入记录
     * @name IncomesList
     * @summary 获取收入记录列表
     * @request GET:/api/incomes
     * @secure
     */
    incomesList: (
      query?: {
        /**
         * 页码
         * @default 1
         */
        page?: number;
        /**
         * 每页数量
         * @default 10
         */
        limit?: number;
        /** 车辆ID筛选 */
        vehicleId?: string;
        /** 收入类型筛选 */
        type?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/incomes`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 收入记录
     * @name IncomesDetail
     * @summary 获取收入记录详情
     * @request GET:/api/incomes/{id}
     * @secure
     */
    incomesDetail: (id: string, params: RequestParams = {}) =>
      this.request<void, void>({
        path: `/api/incomes/${id}`,
        method: 'GET',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 收入记录
     * @name IncomesUpdate
     * @summary 更新收入记录
     * @request PUT:/api/incomes/{id}
     * @secure
     */
    incomesUpdate: (
      id: string,
      data: {
        /** 收入类型 */
        type?: string;
        /** 收入金额 */
        amount?: number;
        /**
         * 收入日期
         * @format date
         */
        date?: string;
        /** 描述 */
        description?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/incomes/${id}`,
        method: 'PUT',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 收入记录
     * @name IncomesDelete
     * @summary 删除收入记录
     * @request DELETE:/api/incomes/{id}
     * @secure
     */
    incomesDelete: (id: string, params: RequestParams = {}) =>
      this.request<void, void>({
        path: `/api/incomes/${id}`,
        method: 'DELETE',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 统计
     * @name StatisticsExpenseList
     * @summary 费用统计（月、季度、年）
     * @request GET:/api/statistics/expense
     * @secure
     */
    statisticsExpenseList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /** 费用类型 */
        type?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/statistics/expense`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 统计
     * @name StatisticsIncomeList
     * @summary 收入统计（月、季度、年）
     * @request GET:/api/statistics/income
     * @secure
     */
    statisticsIncomeList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /** 收入类型 */
        type?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/statistics/income`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 统计
     * @name StatisticsFuelList
     * @summary 油耗统计
     * @request GET:/api/statistics/fuel
     * @secure
     */
    statisticsFuelList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/statistics/fuel`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 统计
     * @name StatisticsExpenseRatioList
     * @summary 费用支付比例统计
     * @request GET:/api/statistics/expense-ratio
     * @secure
     */
    statisticsExpenseRatioList: (
      query?: {
        /** 车辆ID */
        vehicleId?: string;
        /**
         * 开始日期
         * @format date
         */
        startDate?: string;
        /**
         * 结束日期
         * @format date
         */
        endDate?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/statistics/expense-ratio`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 认证
     * @name AuthRegisterCreate
     * @summary 用户注册
     * @request POST:/api/auth/register
     * @secure
     */
    authRegisterCreate: (
      data: {
        /** 用户名 */
        username: string;
        /** 邮箱 */
        email: string;
        /** 密码 */
        password: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/auth/register`,
        method: 'POST',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 认证
     * @name AuthLoginCreate
     * @summary 用户登录
     * @request POST:/api/auth/login
     * @secure
     */
    authLoginCreate: (
      data: {
        /** 用户名 */
        username?: string;
        /** 邮箱 */
        email?: string;
        /** 密码 */
        password: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/auth/login`,
        method: 'POST',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 用户
     * @name AuthProfileList
     * @summary 获取用户信息
     * @request GET:/api/auth/profile
     * @secure
     */
    authProfileList: (params: RequestParams = {}) =>
      this.request<void, void>({
        path: `/api/auth/profile`,
        method: 'GET',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 用户
     * @name AuthProfileUpdate
     * @summary 更新用户信息
     * @request PUT:/api/auth/profile
     * @secure
     */
    authProfileUpdate: (
      data: {
        /** 用户名 */
        username?: string;
        /** 邮箱 */
        email?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/auth/profile`,
        method: 'PUT',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 用户
     * @name AuthChangePasswordUpdate
     * @summary 修改密码
     * @request PUT:/api/auth/change-password
     * @secure
     */
    authChangePasswordUpdate: (
      data: {
        /** 当前密码 */
        currentPassword: string;
        /** 新密码 */
        newPassword: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/auth/change-password`,
        method: 'PUT',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 用户
     * @name AuthDeleteDelete
     * @summary 删除用户
     * @request DELETE:/api/auth/delete
     * @secure
     */
    authDeleteDelete: (
      data: {
        /** 用户密码（确认删除） */
        password: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/auth/delete`,
        method: 'DELETE',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 车辆
     * @name CarsCreate
     * @summary 车辆录入
     * @request POST:/api/cars
     * @secure
     */
    carsCreate: (
      data: {
        /** 车辆昵称 */
        name: string;
        /** 车辆类型 */
        category: '小汽车' | '电车' | '摩托车' | '卡车' | '其他';
        /** 品牌 */
        brand: string;
        /** 型号 */
        carModel: string;
        /** 生产时间（时间戳） */
        productionTime: number;
        /** 购买时间（时间戳） */
        purchaseTime: number;
        /** 车类型（燃油车、电车、摩托车） */
        vehicleType: 'fuel' | 'electric' | 'motor';
        /** 车牌号 */
        licensePlate?: string;
        /** 备注 */
        notes?: string;
        /** 当前里程 */
        currentMileage?: number;
        /** 油箱容积 */
        fuelCapacity?: number;
        /** 燃油类型 */
        fuelType?: '#92' | '#95' | '#98' | '电' | '其他';
        /** 购买价格 */
        purchasePrice?: number;
        /** 货币 */
        currency?: 'CNY' | 'USD' | 'EUR';
        /** 电池容量 */
        batteryCapacity?: number;
        /** 续航里程 */
        mileage?: number;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/cars`,
        method: 'POST',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 车辆
     * @name CarsList
     * @summary 获取车辆列表
     * @request GET:/api/cars
     * @secure
     */
    carsList: (
      query?: {
        /**
         * 页码
         * @default 1
         */
        page?: number;
        /**
         * 每页数量
         * @default 10
         */
        limit?: number;
        /** 车辆类型筛选 */
        category?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/cars`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 车辆
     * @name CarsDetail
     * @summary 获取车辆详情
     * @request GET:/api/cars/{id}
     * @secure
     */
    carsDetail: (id: string, params: RequestParams = {}) =>
      this.request<void, void>({
        path: `/api/cars/${id}`,
        method: 'GET',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 车辆
     * @name CarsUpdate
     * @summary 更新车辆信息
     * @request PUT:/api/cars/{id}
     * @secure
     */
    carsUpdate: (
      id: string,
      data: {
        /** 车辆昵称 */
        name?: string;
        /** 品牌 */
        brand?: string;
        /** 型号 */
        carModel?: string;
        /** 车牌号 */
        licensePlate?: string;
        /** 备注 */
        notes?: string;
        /** 当前里程 */
        currentMileage?: number;
        /** 油箱容积 */
        fuelCapacity?: number;
        /** 燃油类型 */
        fuelType?: string;
        /** 购买价格 */
        purchasePrice?: number;
        /** 货币 */
        currency?: string;
        /** 车类型（燃油车、电车、摩托车） */
        vehicleType?: 'fuel' | 'electric' | 'motor';
        /** 电池容量 */
        batteryCapacity?: number;
        /** 续航里程 */
        mileage?: number;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/cars/${id}`,
        method: 'PUT',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 车辆
     * @name CarsDelete
     * @summary 删除车辆
     * @request DELETE:/api/cars/{id}
     * @secure
     */
    carsDelete: (id: string, params: RequestParams = {}) =>
      this.request<void, void>({
        path: `/api/cars/${id}`,
        method: 'DELETE',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 系统配置
     * @name ConfigExpenseTypesList
     * @summary 获取费用类型列表
     * @request GET:/api/config/expense-types
     * @secure
     */
    configExpenseTypesList: (params: RequestParams = {}) =>
      this.request<void, any>({
        path: `/api/config/expense-types`,
        method: 'GET',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 系统配置
     * @name ConfigExpenseTypesCreate
     * @summary 新增费用类型
     * @request POST:/api/config/expense-types
     * @secure
     */
    configExpenseTypesCreate: (
      data: {
        name?: string;
        code?: string;
        description?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/config/expense-types`,
        method: 'POST',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 系统配置
     * @name ConfigExpenseTypesUpdate
     * @summary 修改费用类型
     * @request PUT:/api/config/expense-types/{id}
     * @secure
     */
    configExpenseTypesUpdate: (
      id: string,
      data: {
        name?: string;
        description?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/config/expense-types/${id}`,
        method: 'PUT',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 系统配置
     * @name ConfigExpenseTypesDelete
     * @summary 删除费用类型
     * @request DELETE:/api/config/expense-types/{id}
     * @secure
     */
    configExpenseTypesDelete: (id: string, params: RequestParams = {}) =>
      this.request<void, any>({
        path: `/api/config/expense-types/${id}`,
        method: 'DELETE',
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 系统配置
     * @name ConfigSystemParamList
     * @summary 获取系统参数
     * @request GET:/api/config/system-param
     * @secure
     */
    configSystemParamList: (
      query: {
        key: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/config/system-param`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 系统配置
     * @name ConfigSystemParamCreate
     * @summary 设置系统参数
     * @request POST:/api/config/system-param
     * @secure
     */
    configSystemParamCreate: (
      data: {
        key?: string;
        value?: string;
        description?: string;
      },
      params: RequestParams = {}
    ) =>
      this.request<void, any>({
        path: `/api/config/system-param`,
        method: 'POST',
        body: data,
        secure: true,
        type: ContentType.Json,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 数据导出
     * @name ExportUserDataList
     * @summary 导出用户所有数据
     * @request GET:/api/export/user-data
     * @secure
     */
    exportUserDataList: (
      query?: {
        /**
         * 导出格式
         * @example "json"
         */
        format?: 'json' | 'csv';
      },
      params: RequestParams = {}
    ) =>
      this.request<
        {
          user?: object;
          vehicles?: any[];
          expenses?: any[];
          incomes?: any[];
          fuelRecords?: any[];
          maintenanceRecords?: any[];
          repairRecords?: any[];
          chargingRecords?: any[];
          exportDate?: string;
          totalRecords?: object;
        },
        void
      >({
        path: `/api/export/user-data`,
        method: 'GET',
        query: query,
        secure: true,
        format: 'json',
        ...params,
      }),

    /**
     * No description
     *
     * @tags 数据导出
     * @name ExportDateRangeList
     * @summary 导出指定时间范围的数据
     * @request GET:/api/export/date-range
     * @secure
     */
    exportDateRangeList: (
      query: {
        /**
         * 开始日期
         * @format date
         * @example "2024-01-01"
         */
        startDate: string;
        /**
         * 结束日期
         * @format date
         * @example "2024-12-31"
         */
        endDate: string;
        /**
         * 数据类型
         * @example "all"
         */
        dataType?:
          | 'all'
          | 'expenses'
          | 'incomes'
          | 'fuel'
          | 'maintenance'
          | 'repair'
          | 'charging';
        /**
         * 导出格式
         * @example "json"
         */
        format?: 'json' | 'csv';
      },
      params: RequestParams = {}
    ) =>
      this.request<void, void>({
        path: `/api/export/date-range`,
        method: 'GET',
        query: query,
        secure: true,
        ...params,
      }),

    /**
     * No description
     *
     * @tags 数据导出
     * @name ExportExpenseReportList
     * @summary 导出费用统计报告
     * @request GET:/api/export/expense-report
     * @secure
     */
    exportExpenseReportList: (
      query?: {
        /**
         * 年份
         * @example 2024
         */
        year?: number;
        /**
         * 月份
         * @min 1
         * @max 12
         * @example 12
         */
        month?: number;
        /**
         * 导出格式
         * @example "json"
         */
        format?: 'json' | 'csv';
      },
      params: RequestParams = {}
    ) =>
      this.request<
        {
          period?: {
            startDate?: string;
            endDate?: string;
          };
          totalExpenses?: number;
          totalAmount?: number;
          expenseStats?: object;
          vehicleStats?: object;
          expenses?: any[];
          exportDate?: string;
        },
        void
      >({
        path: `/api/export/expense-report`,
        method: 'GET',
        query: query,
        secure: true,
        format: 'json',
        ...params,
      }),

    /**
     * No description
     *
     * @tags 数据导出
     * @name ExportBackupCreate
     * @summary 创建数据备份
     * @request POST:/api/export/backup
     * @secure
     */
    exportBackupCreate: (params: RequestParams = {}) =>
      this.request<
        {
          message?: string;
          backup?: {
            version?: string;
            backupDate?: string;
            user?: object;
            data?: object;
            summary?: object;
          };
          downloadUrl?: string;
        },
        void
      >({
        path: `/api/export/backup`,
        method: 'POST',
        secure: true,
        format: 'json',
        ...params,
      }),
  };
}
